-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialise locale formatting in advance as a performance improvement #179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's probably a good argument for designing this in such a way that breaks up and defers possible long tasks to idle time...but I'm on board with not overcomplicating it and erring strongly on the side of the extension not interfering with page performance
Co-authored-by: Brendan Kenny <[email protected]>
@brendankenny upon suggestion from @rviscomi I'm initialising the three formatters needed up front once, rather than each time the metric changes. As the extension is only initialised after the document is WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Relatively straightforward, and if we do somehow detect there's some longer tasks when the script is injected we can always revisit with idle detection or whatever.
Issue raised in #178 (comment)
This initialised the formatters once as the extension is initialised, rather than with each metric update for a god performance improvement, but also allows us to keep the INTL option.